repo.or.cz
/
and.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Adding some more judges, here and there.
[and.git]
/
UVa
/
10298 - Power Strings
/
D.c
blob
ebf04cb13b6a7aabb4c039f4ad4ff2fe83d987c7
1
#include <stdio.h>
2
3
char
s
[
2000002
];
4
5
main
(){
6
int
i
,
j
,
k
,
m
,
n
;
7
while
(
gets
(
s
) &&
strcmp
(
s
,
"."
)) {
8
m
=
n
=
strlen
(
s
);
9
for
(
i
=
2
;
i
<=
n
;
i
++) {
10
while
(
n
%
i
==
0
) {
11
n
/=
i
;
12
for
(
j
=
0
;
j
<
m
-
m
/
i
&&
s
[
j
] ==
s
[
j
+
m
/
i
];
j
++);
13
if
(
j
==
m
-
m
/
i
)
m
/=
i
;
14
}
15
}
16
printf
(
"%d
\n
"
,
strlen
(
s
)/
m
);
17
}
18
}